#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.8.0
 Author:         James Chen

 Script Function:
	Template AutoIt script.

#ce ----------------------------------------------------------------------------

Opt("MouseCoordMode", 0)

; Script Start - Add your code below here

$ClickSpeed = 1

$MouseClickSleep = 10

; Static Variables for Type selection
$OneOne0 = 796
$OneOne1 = 500

$Delta0 = 79
$Delta1 = 38

$HW0 = 1
$HW1 = 1

$HWP0 = 2
$HWP1 = 1

$Coin0 = 3
$Coin1 = 2

$Horse0 = 2
$Horse1 = 3

$Bow0 = 1
$Bow1 = 3

$Fish0 = 4
$Fish1 = 1

$Water0 = 5
$Water1 = 1

$Bread0 = 4
$Bread1 = 2

$EW0 = 1
$EW1 = 1

$EWP0 = 2
$EWP1 = 1

$Granite0 = 2
$Granite1 = 2

$Xbow0 = 1
$Xbow1 = 3

$BronzeSword0 = 5
$BronzeSword1 = 2

$Cannon0 = 2
$Cannon1 = 3

$Egg0 = 5
$Egg1 = 1

$MapFrag0 = 1
$MapFrag1 = 2

$SteelSword0 = 4
$SteelSword1 = 3

;-----------------------------------------------------------------------------------------------

$Trade0 = 974
$Trade1 = 587

$TradeDelta0 = 72
$TradeDelta1 = 30

$DeliverSelect0 = 803
$DeliverSelect1 = 658

$ReceiveSelect0 = 1142
$ReceiveSelect1 = $DeliverSelect1

$OK0 = 1082
$OK1 = 721

$SendBasicTab0 = 796
$SendBasicTab1 = 646

$SendIntermediateTab0 = 883
$SendIntermediateTab1 = $SendBasicTab1

$SendAdvancedTab0 = 972
$SendAdvancedTab1 = $SendBasicTab1

$SendExpertTab0 = 1062
$SendExpertTab1 = $SendBasicTab1

$SendItemTab0 = 1152
$SendItemTab1 = $SendBasicTab1

$RecieveBasicTab0 = 803
$RecieveBasicTab1 = 646

$RecieveIntermediateTab0 = 920
$RecieveIntermediateTab1 = $RecieveBasicTab1

$RecieveAdvancedTab0 = 1028
$RecieveAdvancedTab1 = $RecieveBasicTab1

$RecieveExpertTab0 = 1139
$RecieveExpertTab1 = $RecieveBasicTab1

$PlusOne0 = 1019
$PlusOne1 = 731

$MinusOne0 = 821
$MinusOne1 = $PlusOne1

;------------------------------------------------------------------------------------------------

; Number Statics
$One0 = 835
$One1 = 732

$Two0 = 848
$Two1 = $One1

$Five0 = 849
$Five1 = $One1

$Ten0 = 851
$Ten1 = $One1

$Thirteen0 = 852
$Thirteen1 = $One1

$Sixteen0 = 853
$Sixteen1 = $One1

$TwentyFour0 = 856
$TwentyFour1 = $One1

$TwentySeven0 = 857
$TwentySeven1 = $One1

$Thirty0 = 858
$Thirty1 = $One1

$ThirtyEight0 = 861 ;True Lock
$ThirtyEight1 = $One1

$FortyOne0 = 862
$FortyOne1 = $One1

$FortyFour0 = 863 ;True lock
$FortyFour1 = $One1

$FortySix0 = 864
$FortySix1 = $One1

$FortyNine0 = 865 ;856 before
$FortyNine1 = $One1

$FiftyTwo0 = 866
$FiftyTwo1 = $One1

$NinetyNine0 = 883
$NinetyNine1 = $One1

$OneHundredTwentyOne0 = 891
$OneHundredTwentyOne1 = $One1

$OneHundredTwentyNine0 = 894
$OneHundredTwentyNine1 = $One1

$OneHundredThirtyFour0 = 896
$OneHundredThrityFour1 = $One1

$OneHundredFiftyOne0 = 902
$OneHundredFiftyOne1 = $One1

$TwoHundredOne0 = 920
$TwoHundredOne1 = $One1

$TwoHundredTwentyFive0 = 929
$TwoHundredTwentyFive1 = $One1

$TwoHundredFifty0 = 938
$TwoHundredFifty1 = $One1

$ThreeHundred0 = 956
$ThreeHundred1 = $One1

$FourHundred0 = 1002
$FourHundred1 = $One1

$MousePosX = MouseGetPos(0)
$MousePosY = MouseGetPos(1)

;---------------------------------------------------------------------------------------------

HotKeySet("^!{home}", "SendTrade")
HotKeySet("^!{backspace}", "end")

;MouseClick("left", $MinusOne0, $MinusOne1, $ClickSpeed)
;MouseClick("left", $PlusOne0, $PlusOne1, 1, $ClickSpeed)

;---------------------------------------------------------------------------------------------

Beep()

While True

	$MousePosX = MouseGetPos(0)
	$MousePosY = MouseGetPos(1)

	Sleep(1)

WEnd

Func SendTrade()

	If Not WinActive("The Settlers Online - Zeus [Realm 1] - Google Chrome", "") Then WinActivate("The Settlers Online - Zeus [Realm 1] - Google Chrome", "")

	$MousePosX = MouseGetPos(0)
	$MousePosY = MouseGetPos(1)

	Beep()

	MouseClick("left")

	MouseClick("left", $MousePosX+$TradeDelta0, $MousePosY-$TradeDelta1, 1)

	; Deliver Select
	MouseClick("left", $DeliverSelect0, $DeliverSelect1, 1)

	;Send Sequence--------------------------------------------------------------------------------------

	MouseClick("left", $SendAdvancedTab0, $SendAdvancedTab1, 1, $ClickSpeed)

	MouseClick("left", $OneOne0 + (($Coin0 - 1) * $Delta0), $OneOne1 + (($Coin1 - 1) * $Delta1), 1)

	MouseClick("left", $Two0, $Two1, 1)

	;----------------------------------------------------------------------------------------------------

	; Select OK Button
	MouseClick("left", $OK0, $OK1, $ClickSpeed)

	; Receive Select
	MouseClick("left", $ReceiveSelect0, $ReceiveSelect1, $ClickSpeed)

	;Recieve Sequence--------------------------------------------------------------------------------------

	MouseClick("left", $RecieveBasicTab0, $RecieveBasicTab1, 1)

	MouseClick("left", $OneOne0 + (($Fish0 - 1) * $Delta0), $OneOne1 + (($Fish1 - 1) * $Delta1), 1)

	MouseClick("left", $FourHundred0, $FourHundred1, 1)

	;----------------------------------------------------------------------------------------------------

	; Select OK Button
	MouseClick("left", $OK0, $OK1, $ClickSpeed)

	Sleep(50)

	; Send Trade
	MouseClick("left", $Trade0, $Trade1, $ClickSpeed)

	MouseMove($MousePosX, $MousePosY, $ClickSpeed)

EndFunc

Func end()
	Exit
EndFunc   ;==>end